#ifndef TEXT_FILE_SEARCHER_H
#define TEXT_FILE_SEARCHER_H

#include <wx/string.h>
#include <wx/textfile.h>

class TextFileSearcher {
  public:
    enum eFileSearcherReturn {
      idStringFound = 0,
      idStringNotFound,
      idFileNotFound,
      idFileOpenError
    };
    static TextFileSearcher* BuildTextFileSearcher( const wxString& searchText,
        bool matchCase,
        bool matchWordBegin,
        bool matchWord,
        bool regEx );
    virtual ~TextFileSearcher() {};
    virtual bool MatchLine( wxString line ) = 0;
    virtual bool IsOk( wxString* pErrorMessage = NULL );
    eFileSearcherReturn FindInFile( const wxString& filePath, wxArrayString &foundLines );
  protected:
    TextFileSearcher( const wxString& searchText, bool matchCase, bool matchWordBegin, bool matchWord ):
      m_SearchText( searchText ),
      m_MatchCase( matchCase ),
      m_MatchWordBegin( matchWordBegin ),
      m_MatchWord( matchWord ) {}
    wxString m_SearchText;
    bool m_MatchCase;
    bool m_MatchWordBegin;
    bool m_MatchWord;
    wxTextFile m_TextFile;
};

#endif
